Skip to content

feat: storeReviews 좋아요순 정렬(sort=LIKES) 추가 - #173

Merged
chanwoo7 merged 1 commit into
developfrom
feat/store-reviews-likes-sort
Aug 6, 2026
Merged

feat: storeReviews 좋아요순 정렬(sort=LIKES) 추가#173
chanwoo7 merged 1 commit into
developfrom
feat/store-reviews-likes-sort

Conversation

@chanwoo7

@chanwoo7 chanwoo7 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

FE 요청 반영: storeReviewssort(LATEST/LIKES)를 추가한다. 현재는 최신순만 지원해 FE가 받은 페이지 안에서 재정렬해도 전체 기준 좋아요순이 될 수 없는 문제(1페이지에 없는 리뷰가 실제 좋아요 1위일 수 있음)를 해결한다. productReviews의 검증된 구현을 동일 의미론으로 미러링한다.

  • StoreReviewsInput.sort: StoreReviewSort = LATEST (+ StoreReviewSort enum)
  • 좋아요순: soft-delete 좋아요 제외 집계 desc, 동률이면 최신순(id desc)
  • 좋아요순 커서는 "<likeCount>:<id>" 불투명 토큰 — 경계 시점 좋아요 수를 담아 요청 사이 좋아요 변동에도 페이지 중복/누락 없음

Scope

  • store-reviews.graphqlsort 입력 + enum, cursor 설명 갱신 (additive)
  • store-reviews.input.tsSTORE_REVIEW_SORTS + @IsIn 검증
  • store-review.repository.ts — product 미러로 id 페이지 + hydrate 구조 재편: listStoreReviewIdsLatest / listStoreReviewIdsByLikes(raw 키셋) / findStoreReviewRowsByIds
  • store-review.service.tsfetchReviewIdPage + parseLikesCursor(안전 정수 검증) + hydrateReviews
  • store-review-error-messages.tsINVALID_LIKES_CURSOR 신설

진행 상황

  • SDL/DTO/repository/service 구현 (product LIKES 구현 미러, 릴리즈 리뷰 반영분 안전 정수 검증 포함)
  • codegen · yarn dto:check · yarn arch:check 통과
  • 테스트 5건 추가, yarn validate 전체 green

Impact

  • 기존 FE 호출 영향 없음: sort 미지정 시 LATEST, LATEST 커서는 기존과 동일한 마지막 리뷰 id 방식.
  • LIKES 커서는 sort 간 호환되지 않음(동일 sort 안에서만 유효) — productReviews와 동일 규칙.
  • DB 마이그레이션 없음.

Test plan

  • 좋아요순 정렬: soft-delete 좋아요 제외 집계, 동률이면 최신순
  • 좋아요순 + photoOnly 조합
  • 좋아요순 커서: (likeCount, id) 키셋으로 다음 페이지 이어받기 (nextCursor 형식 검증 포함)
  • 잘못된 커서 형식·자릿수 폭탄 → BadRequestException (BAD_USER_INPUT)
  • resolver 통합: sort=LIKES 전달 경로
  • 기존 store 스위트 포함 13개(81건) green

FE 요청 반영. 페이지 내 클라이언트 정렬로는 전체 기준 좋아요순이
불가능해 productReviews와 동일 의미론의 sort(LATEST/LIKES)를 추가한다.

- repository를 id 페이지 + hydrate 구조로 재편(product 미러)
- 좋아요순은 soft-delete 좋아요 제외 집계 기준이라 raw 키셋
  페이지네이션((likeCount, id) 커서) 사용
- "<likeCount>:<id>" 커서 파싱에 안전 정수 검증 포함
- 기존 호출 영향 없음(sort 기본 LATEST, LATEST 커서는 기존 id 방식)
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 10ca7dba-ad8e-4e84-a9a3-6ad064b28f74

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🧹 knip — dead-code 리포트

요약 항목 없음
전체 리포트
(knip 출력 없음 — 이슈 0이거나 실행 실패)

청소 후보(오탐 가능) · 기준 docs/guide/architecture-conventions.md

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🩺 NestJS Doctor — 89/100 (Good)

진단 271건 (error 0).

Category error warning info
architecture 0 0 13
correctness 0 119 0
performance 0 24 16
schema 0 0 86
security 0 13 0
architecture / security 상위 항목
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'IAuditLogRepository'.
  • warning security/security/no-exposed-env-vars: Direct 'process.env.NODE_ENV' access in 'AuthController'. Use ConfigService instead.
  • warning security/security/require-guards-on-endpoints: Endpoint 'start' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'callback' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'refresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'logout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogin' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerRefresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'devIssueToken' has no @UseGuards() at class or method level.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/conversation/repositories/conversation.repository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'ConversationRepository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/order/repositories/order.repository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'OrderRepository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/product/repositories/product.repository'.

오탐 포함 가능 · 기준 docs/guide/architecture-conventions.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e88ea3c1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +90 to +91
? Prisma.sql`HAVING COUNT(l.id) < ${args.cursor.likeCount}
OR (COUNT(l.id) = ${args.cursor.likeCount} AND r.id < ${args.cursor.id})`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a stable like-rank snapshot across pages

When any review's likes change between page requests, this predicate compares every review's live COUNT(l.id) with a stale boundary and therefore does not prevent duplicates or omissions as claimed. For example, after a first page ends at 9 likes, an unseen 8-like review that rises to 10 is excluded from every subsequent query, while an already-returned 10-like review that drops to 8 is returned again. The cursor must identify a stable ranking snapshot/version, or the API must otherwise account for already-seen rows, to provide mutation-safe pagination.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의도된 트레이드오프로 유지. 이 커서의 목적은 경계 리뷰의 좋아요 변동으로 인한 인접 페이지 즉시 중복/누락 방지까지이고, 임의 리뷰의 전역 변동까지 막으려면 랭킹 스냅샷·seen-set 커서가 필요해 공개 목록 조회에 과한 비용. 이미 릴리즈된 productReviews의 listProductReviewIdsByLikes와 동일 구현·동일 수용 기준이라 정합성 차원에서도 동일하게 둠.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ures/store/repositories/store-review.repository.ts 87.50% 1 Missing ⚠️
...rc/features/store/services/store-review.service.ts 97.14% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.64% 4338/4443
🟢 Branches 93.56% 1381/1476
🟢 Functions 95.66% 838/876
🟢 Lines 98.11% 3954/4030

Test suite run success

1472 tests passing in 173 suites.

Report generated by 🧪jest coverage report action from 8e88ea3

@chanwoo7
chanwoo7 merged commit b75c39c into develop Aug 6, 2026
12 checks passed
@chanwoo7
chanwoo7 deleted the feat/store-reviews-likes-sort branch August 6, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant